SUBROUTINE PARA
* Demonstrate the use of the RW_START_PARA and RW_END_PARA subroutines.* Include the RealWeb definitions
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP
* Start the HTML page.CALL RW_START_HTML_PAGE("Paragraph Example 1", "", "", "", "")* Define some CSS styles.
STYLES = "p {" : ...
"font-family: Lucida Sans Unicode;" : ...
"font-size: 10pt;" : ...
"}"
STYLES = STYLES : "#last {" : ...
"font-family: Comic Sans MS;" : ...
"font-size: 14pt;" : ...
"color: blanchedalmond;" : ...
"background-color: forestgreen;" : ...
"margin-left: 100px;" : ...
"margin-right: 100px;" : ...
"border: thick inset crimson;" : ...
"padding: 10px;" : ...
"text-align: center;" : ...
"}"
STYLES = STYLES : ".special {" : ...
"font-family: Arial;" : ...
"font-size: 9pt;" : ...
"color: darkblue;" : ...
"text-align: right;" : ...
"}"
CALL RWS_STYLE(STYLES, "")CALL RW_PUT_EX(STYLES, RWD_HEAD)* Insert some paragraphs.
CALL RW_PUT("This is the first paragraph, at the very beginning " : ...
"of the body of the document. ")
CALL RW_PUT("Because it is not preceded by a call to " : ...
"RW_START_PARA, it is not subject to any formatting " : ...
"defined in the style sheet for the <p> tag.")
CALL RW_START_PARA("", "")
CALL RW_PUT("A call to RW_START_PARA signals the start of this " : ...
"second paragraph. ")
CALL RW_PUT("When rendered by a browser, it will begin slightly " : ...
"below the end of the first paragraph, with a bit of extra " : ...
"white space between the two paragraphs. ")
CALL RW_PUT("We now also get the CSS formatting for the <p> tag.")CALL RW_START_PARA("", "")
CALL RW_PUT("The browser infers that when you start a new " : ...
"paragraph you have finished the previous one, so calling " : ...
"RW_END_PARA is not strictly necessary. ")
CALL RW_PUT("However, it is good practice, and if we were using " : ...
"XHTML it would be mandatory.")
CALL RW_END_PARACALL RW_START_PARA("", "special")
CALL RW_PUT("The next two paragraphs show how you can change the " : ...
"appearance of the text with CSS styles. ")
CALL RW_PUT("This can be done by applying a class...")CALL RW_END_PARACALL RW_START_PARA("last", "")CALL RW_PUT("...or through the paragraph's id. ")CALL RW_END_PARACALL RW_START_PARA("", "")CALL RW_PUT("This is the last paragraph in the example.")CALL RW_END_PARA* Complete the page.CALL RW_END_PAGE
RETURN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><META NAME="Generator" CONTENT="Reality"><TITLE>Paragraph Example 1</TITLE><STYLE TYPE="text/css"><!--
p {
font-family: Lucida Sans Unicode;
font-size: 10pt;
}
#last {font-family: Comic Sans MS;
font-size: 14pt;
color: white;
background-color: navy;
margin-left: 100px;
margin-right: 100px;
border: thick inset blue;
padding: 10px;
text-align: center;
}
.special {
font-family: Arial;
font-size: 9pt;
color: maroon;
text-align: right;
}
--></STYLE></HEAD><BODY>
This is the first paragraph, at the very beginning of the body of the document.
Because it is not preceded by a call to RW_START_PARA, it is not subject to any
formatting defined in the style sheet for the <p> tag.
<P>
A call to RW_START_PARA signals the start of this second paragraph.
When rendered by a browser, it will begin slightly below the end of the first
paragraph, with a bit of extra white space between the two paragraphs.
We now also get the CSS formatting for the <p> tag.
<P>
The browser infers that when you start a new paragraph you have finished the
previous one, so calling RW_END_PARA is not strictly necessary.
However, it is good practice, and if we were using XHTML it would be mandatory.
</P><P CLASS="special">
The next two paragraphs show how you can change the appearance of the text with CSS styles.
This can be done by applying a class...
</P><P ID="last">
...or through the paragraph's id.
</P><P>
This is the last paragraph in the example.
</P></BODY></HTML>